package com.handler;

import com.ymx.darling.type.TypeHandler;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author 爱Java的小于
 */
public class CharArrayTypeHandler implements TypeHandler<char[]> {
    @Override
    public char[] getResult(ResultSet resultSet, int columIndex) throws SQLException {
        String phoneString = resultSet.getString(columIndex);
        return phoneString.toCharArray();
    }

    @Override
    public void setParameter(PreparedStatement statement, char[] value, int index) throws SQLException {
        statement.setString(index, String.valueOf(value));
    }
}
